package com.hxy.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hxy.dao.RpkindMapper;

import com.hxy.pojo.Rpkind;
import com.hxy.pojo.Trainnote;
import com.hxy.pojo.vo.TrainnoteVo;

import com.hxy.service.RpkindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class RpkindServiceImpl implements RpkindService {
    @Autowired
    private RpkindMapper rpkindMapper;


    @Override
    public int insertRpkind(Rpkind rpkind) {
        return rpkindMapper.insertRpkind(rpkind);
    }

    @Override
    public int updateRpkind(Rpkind rpkind) {
        return rpkindMapper.updateRpkind(rpkind);
    }

    @Override
    public PageInfo<Rpkind> selectRpkind(Integer pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Rpkind> rpkinds = rpkindMapper.selectRpkind();
        PageInfo<Rpkind> rpkindPageInfo = new PageInfo<>(rpkinds);
        return rpkindPageInfo;
    }

    @Override
    public int deleteRpkind(Integer id) {
        return rpkindMapper.deleteRpkind(id);
    }

    @Override
    public PageInfo<Rpkind> findRpkindByTJ(String name, Integer curPage, int pageSize) {
        PageHelper.startPage(curPage,pageSize);
        List<Rpkind> rpkinds = rpkindMapper.findRpkindByTJ(name);
        PageInfo<Rpkind> televisionPageInfo = new PageInfo<>(rpkinds);
        return televisionPageInfo;
    }

    @Override
    public Rpkind findById(Integer id) {
        return rpkindMapper.findById(id);
    }

}
